package pers.course.others;

import java.util.Scanner;

public class LuckyNumber {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long num = in.nextLong();
        int methods = 0;
        for (long i = 0; i < (num / 3 + 1); i++) {
            for (long j = 0; j < (num / 5 + 1); j++) {
                for (long k = 0; k < (num / 7 + 1); k++) {
                    if (Math.pow(3, i) * Math.pow(5, j) * Math.pow(7, k) <= num && (i + j + k > 0)) {
                        methods++;
                    }
                }
            }
        }
        System.out.println(methods);
    }
}
